package cn.wolfcode.controller;


import cn.wolfcode.domain.*;
import cn.wolfcode.query.StrategyQueryObject;
import cn.wolfcode.service.IDestinationService;
import cn.wolfcode.service.IRegionService;
import cn.wolfcode.service.IStrategyService;
import cn.wolfcode.service.IStrategyThemeService;
import cn.wolfcode.util.JsonResult;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description: 前后端分离目的地控制器类
 * @Author: 伍家钰
 * @Date: 2020/8/11 18:53
 * @Version: 1.0
 */
@RestController
@RequestMapping("strategies")
public class StrategyController {
    @Resource
    private IStrategyService strategyService;
    @Resource
    private IStrategyThemeService strategyThemeService;

    /**
     * 攻略明细
     *
     * @return
     */
    @RequestMapping("detail")
    public Object queryDetail(String id) {
        Strategy strategy = strategyService.get(id);
        return JsonResult.success(strategy);
    }

    /**
     * 攻略分页查询
     *
     * @return
     */
    @RequestMapping("query")
    public Object query(StrategyQueryObject qo) {
        Page<Strategy> query = strategyService.query(qo);
        return JsonResult.success(query);
    }

    /**
     * 攻略主题
     *
     * @return
     */
    @RequestMapping("themes")
    public Object themes() {
        List<StrategyTheme> list = strategyThemeService.list();
        return JsonResult.success(list);
    }


}
